package com.cbd.pojo;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.validation.annotation.Validated;

/**
 * 租车意向
 * 
 */
@Entity
@Table(name = "purpose")
@Validated
public class Purpose implements Serializable {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "purposeID")
	private int purposeID;
	/**
	 * 留言
	 * 
	 */
	@Column(name = "note")
	@NotEmpty(message = "不能为空")
	@Length(max = 20, min = 3, message = "长度必须为3-20位")
	private String note;
	/**
	 * 是否成交 0：没有成交 1：成交 true
	 * 
	 */
	@Column(name = "isDeal")
	private boolean isDeal;
	@OneToOne(cascade = CascadeType.ALL, mappedBy = "purpose")
	private Record record;
	/**
	 * 很多租客
	 */
	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "renterID")
	private Renter renter;
	/**
	 * 租车信息
	 */
	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "rentInfoID")
	private RentInfo rentInfo;

	public int getPurposeID() {
		return purposeID;
	}

	public void setPurposeID(int purposeID) {
		this.purposeID = purposeID;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public boolean isDeal() {
		return isDeal;
	}

	public void setDeal(boolean isDeal) {
		this.isDeal = isDeal;
	}

	public Record getRecord() {
		return record;
	}

	public void setRecord(Record record) {
		this.record = record;
	}

	public Renter getRenter() {
		return renter;
	}

	public void setRenter(Renter renter) {
		this.renter = renter;
	}

	public RentInfo getRentInfo() {
		return rentInfo;
	}

	public void setRentInfo(RentInfo rentInfo) {
		this.rentInfo = rentInfo;
	}

}